package testPaper;

import java.io.*;

/**
 * @author Yancy
 * @program springioctest
 * @create 2020-11-21
 */
public class TestFile {
  public static void main(String[] args) {
    //
  try{
      File file = new File("myFile.text");
      System.out.println("文件名称："+file.getName());
      FileInputStream fis = new FileInputStream(file);
      InputStreamReader isr = new InputStreamReader(fis);
      BufferedReader br = new BufferedReader(isr);
      String s;
      System.out.println("文件内容为：");
      while ((s = br.readLine()) != null){
        System.out.println(s);
      }

      System.out.println("文件长度为："+file.length());

  }catch (Exception e){
      System.out.println("程序运行过程中出现异常！");
  }

  }
}
